package com.sora.eduservice.controller.front;

import com.sora.commonutils.R;
import com.sora.eduservice.entity.EduCourse;
import com.sora.eduservice.entity.EduTeacher;
import com.sora.eduservice.service.EduCourseService;
import com.sora.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @Classname: IndexFrontController
 * @Description:
 * @Author: Stonffe
 * @Date: 2023/1/11 15:49
 */
@RestController
@RequestMapping("/eduservice/indexFront")
@CrossOrigin
public class IndexFrontController {
    @Autowired
    private EduTeacherService teacherService;
    @Autowired
    private EduCourseService courseService;
    @GetMapping("index")
    public R index() {
        List<EduCourse> courses = courseService.selectHotCourse();
        List<EduTeacher> teachers = teacherService.selectHotTeacher();
        HashMap<String, Object> map = new HashMap<>();
        map.put("courseList",courses);
        map.put("teacherList",teachers);
        return R.ok().data(map);
    }
}
